package com.ruoyi.web.controller.yf;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yf.domain.YfHospitalIndividuationData;
import com.ruoyi.yf.service.IYfHospitalIndividuationDataService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 医院个性化配置Controller
 * 
 * @author XiaoYi...
 * @date 2020-08-24
 * 756da16a-5925-4f5a-9367-32a891222c45
 */
@Controller
@RequestMapping("/yf/hospitalIndividuation")
public class YfHospitalIndividuationDataController extends BaseController
{
    private String prefix = "yf/hospitalIndividuation";

    @Autowired
    private IYfHospitalIndividuationDataService yfHospitalIndividuationDataService;

    @RequiresPermissions("yf:hospitalIndividuation:view")
    @GetMapping()
    public String hospitalIndividuation()
    {
        return prefix + "/hospitalIndividuation";
    }

    /**
     * 查询医院个性化配置列表
     * fe8090cc-02aa-4590-bbbb-905f638027e7
     */
    @RequiresPermissions("yf:hospitalIndividuation:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(YfHospitalIndividuationData yfHospitalIndividuationData)
    {
        startPage();
        List<YfHospitalIndividuationData> list = yfHospitalIndividuationDataService.selectYfHospitalIndividuationDataList(yfHospitalIndividuationData);
        return getDataTable(list);
    }

    /**
     * 导出医院个性化配置列表
     * c4768610-5c3b-4e71-84ab-8993c3f631bb
     */
    @RequiresPermissions("yf:hospitalIndividuation:export")
    @Log(title = "医院个性化配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(YfHospitalIndividuationData yfHospitalIndividuationData)
    {
        List<YfHospitalIndividuationData> list = yfHospitalIndividuationDataService.selectYfHospitalIndividuationDataList(yfHospitalIndividuationData);
        ExcelUtil<YfHospitalIndividuationData> util = new ExcelUtil<YfHospitalIndividuationData>(YfHospitalIndividuationData.class);
        return util.exportExcel(list, "hospitalIndividuation");
    }

    /**
     * 新增医院个性化配置
     * bbbd6056-378c-4493-b96c-c4a6dd2f5ae7
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存医院个性化配置
     * 40448bcf-fdb9-4375-8178-d3adb1cf5692
     */
    @RequiresPermissions("yf:hospitalIndividuation:add")
    @Log(title = "医院个性化配置", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(YfHospitalIndividuationData yfHospitalIndividuationData)
    {
        return toAjax(yfHospitalIndividuationDataService.insertYfHospitalIndividuationData(yfHospitalIndividuationData));
    }

    /**
     * 修改医院个性化配置
     * e18adb24-ec6b-425a-ac49-edfcd741f227
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        YfHospitalIndividuationData yfHospitalIndividuationData = yfHospitalIndividuationDataService.selectYfHospitalIndividuationDataById(id);
        mmap.put("yfHospitalIndividuationData", yfHospitalIndividuationData);
        return prefix + "/edit";
    }

    /**
     * 修改保存医院个性化配置
     * 9bd813a2-377f-43a5-a11c-10c58551d371
     */
    @RequiresPermissions("yf:hospitalIndividuation:edit")
    @Log(title = "医院个性化配置", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(YfHospitalIndividuationData yfHospitalIndividuationData)
    {
        return toAjax(yfHospitalIndividuationDataService.updateYfHospitalIndividuationData(yfHospitalIndividuationData));
    }

    /**
     * 删除医院个性化配置
     * 0eff19f6-eab7-4ba7-a663-bb8d32b10344
     */
    @RequiresPermissions("yf:hospitalIndividuation:remove")
    @Log(title = "医院个性化配置", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(yfHospitalIndividuationDataService.deleteYfHospitalIndividuationDataByIds(ids));
    }
}
